﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace THEMXOASUA
{
    /// <summary>
    /// Interaction logic for LOGINWINDOW.xaml
    /// </summary>
    public partial class LOGINWINDOW : Window
    {
        
        public LOGINWINDOW()
        {
            InitializeComponent();
        }
        
        private void Expander_Expanded(object sender, RoutedEventArgs e)
        {
            this.Height = 390;
        }
        private void Expander_Collapsed(object sender, RoutedEventArgs e)
        {
            this.Height = 275;
        }

        private void dongy_Click(object sender, RoutedEventArgs e)//nut dông ý
        {
             USERS us = new USERS();
             APLICATIONCONFIG AP=new APLICATIONCONFIG();
             APLICATIONCONFIG.Users = txttendangnhap.Text;
             APLICATIONCONFIG.Pass = password.Password;
             APLICATIONCONFIG.Usenamedb = cbbmaychu.Text;
             APLICATIONCONFIG.Passworddb = cbbmatkhau.Password;
             APLICATIONCONFIG.Severname = cbbtennguoidung.Text;    
            USERS usr = new USERS();
            DataTable dt = usr.DANHSACH_USERS(APLICATIONCONFIG.Users, APLICATIONCONFIG.Pass);
            if (dt.Rows.Count > 0)
            {
                MessageBoxResult result = MessageBox.Show(" Đăng nhập thành công", "THÔNG BÁO");
                this.Close();
            }
            else
            {
                MessageBoxResult result = MessageBox.Show(" Bạn đã nhập sai mật khẩu", "THÔNG BÁO", MessageBoxButton.YesNo, MessageBoxImage.Error);

            }

        }

        private void thoat_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
